<script setup>
import * as THREE from 'three';
import { onMounted, onUnmounted, ref } from 'vue';

import { inverseKinematics } from '@/lib/inverse/kinematicsInverse.js';



onMounted(() => {

  const robot = {
    params: [0.345, 0.02, 0.260, 0.020, 0.26, 0.075], // 机械臂参数
    initialThetaOffset: [0,0,-Math.PI/2,0,0,Math.PI],
    calculateInverseKinematics: inverseKinematics
  };

  const targetPosition = new THREE.Vector3(0.8, 0.5, 0.3);
  const targetRotation = new THREE.Euler(0, Math.PI/4, 0, "XYZ");

  const solution = robot.calculateInverseKinematics(targetPosition, targetRotation);
  if (solution) {
    console.log("关节角度解：", solution);
  } else {
    console.log("无有效解");
  }


});

onUnmounted(() => {

});
</script>

<template>
  <div ref="container"></div>
</template>

<style scoped>
div {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  /* overflow: hidden; */
}
</style>
